import request from '@/utils/request';
import { smaiuacServiceBaseUrl, smaiservServiceBaseUrl } from '@/api/config';
// 登录
export function login(data) {
  return request({
    url: smaiuacServiceBaseUrl + '/api/v1/tokens/make_credentials',
    method: 'post',
    data
  });
}
// 获取用户信息
export function getInfo() {
  return request({
    url: smaiuacServiceBaseUrl + '/api/v1/user_resource/user_profile',
    method: 'get'
  });
}
// 退出
export function logout(token) {
  return request({
    url: smaiuacServiceBaseUrl + '/api/v1/tokens/destroy_credentials',
    method: 'post',
    data: { 'access_token': token }
  });
}
// 获取logo
export function getLogo() {
  return request({
    url: smaiuacServiceBaseUrl + '/api/v1/user_resource/user_logo',
    method: 'get'
  });
}
// 获取模块信息
export function getModulePermission() {
  return request({
    url: smaiuacServiceBaseUrl + '/api/v1/tokens/require_permissions?require=module&show_type=list',
    method: 'get'
  });
}
// 获取项目、科室、病种权限信息
export function getMultiDataPermissions() {
  return request({
    url: smaiuacServiceBaseUrl + '/api/v1/tokens/token_permissions',
    method: 'get'
  });
}
// 获取项目数量
export function getDiseasedbCount() {
  return request({
    url: smaiservServiceBaseUrl + '/api/v2/projects/data/amount',
    method: 'get'
  });
}
// 获取项目基础信息
export function getBaseInfo(projectId) {
  return request({
    url: smaiservServiceBaseUrl + `/api/v2/projects/data/base_info?project_id=${projectId}
    &r_type=inspect_info&r_type=verify_info&r_type=sms_center_info&r_type=follow_info&r_type=auto_number_info&r_type=state_tag_info&r_type=people_show_info`,
    method: 'get'
  });
}
// 获取项目统计信息
export function getStatisticsInfo(projectId) {
  return request({
    url: smaiservServiceBaseUrl + `/api/v2/projects/data/statistics_info`,
    method: 'get',
    params: { project_id: projectId }
  });
}
// 获取项目字段数据
export function getFieldData(param) {
  return request({
    url: smaiservServiceBaseUrl + '/api/v2/projects/meta_list',
    method: 'get',
    params: {
      project_id: param.projectId,
      type: param.type,
      last_update_time: param.last_update_time

    }
  });
}
// 获取联想字段数据
export function getAssociationData(params) {
  return request({
    url: smaiservServiceBaseUrl + '/api/v2/projects/meta/list',
    method: 'get',
    params: {}
  });
}
// 获取任务id
export function getTableContentData(data) {
  return request({
    url: smaiservServiceBaseUrl + '/api/v2/projects/data/list',
    method: 'post',
    data
  });
}
// 获取表格内容
export function queryTaskId(taskId) {
  return request({
    url: smaiservServiceBaseUrl + `/api/v2/projects/data/query_task?task_id=${taskId}`,
    method: 'get'
  });
}
// 导出数据
export function exportData(data) {
  return request({
    url: smaiservServiceBaseUrl + `/api/v2/projects/data/export`,
    method: 'post',
    data
  });
}
// 添加至时 获取科室、项目信息
export function getProjectData(param) {
  return request({
    url: smaiservServiceBaseUrl + `/api/v2/projects/data/copy/list`,
    method: 'get',
    params: {}
  });
}
